Although conventionally the planar structure of NAND flash memory has been shrunk to increase the bit density and reduce the bit cost, such shrink is approaching a limit. Therefore, in recent years, technology has been proposed to stack the memory cells in the vertical direction. The data retention characteristics of the memory cells are problematic in such a stacked memory device.